#ifndef STANDARDTABLEMODEL_H
#define STANDARDTABLEMODEL_H

#include <QAbstractTableModel>

class StandardTableModel : public QAbstractTableModel
{
    Q_OBJECT
public:
    explicit StandardTableModel (QObject* parent = 0);

public:
    virtual int rowCount (const QModelIndex &parent = QModelIndex()) const;
    virtual int columnCount (const QModelIndex &parent = QModelIndex()) const;
    virtual QVariant data (const QModelIndex &index, int role = Qt::DisplayRole) const;
    virtual QVariant headerData (int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
    virtual bool setData (const QModelIndex &index, const QVariant &value, int role);
    virtual bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role);
    virtual bool removeRows (int row, int count, const QModelIndex &parent = QModelIndex());
    virtual bool removeColumns (int column, int count, const QModelIndex &parent = QModelIndex());
    virtual bool insertRows (int row, int count, const QModelIndex& parent = QModelIndex());
    virtual bool insertColumns (int column, int count, const QModelIndex & parent = QModelIndex());

    QList<QList<QHash<int,QVariant>>>& itemData();

public slots:
    void setRowCount (int rows);
    void setColumnCount (int columns);
    void appendRow();
    void appendRow (QVariantList dataList);
    void appendColumn (QVariantList dataList);
    void insertRow (int row, QVariantList dataList);
    void insertColumn (int column, QVariantList dataList);
    void removeRows (const QList<int>& rows);
    void removeRows (const QVariantList& rows);
    void swapColumns (int firstColumn, int secondColumn);
    void clear();

    void beginResetModelSlot();
    void endResetModelSlot();

protected:
    QList<QList<QHash<int,QVariant>>> m_itemData;
    QList<QHash<int,QVariant>> m_headerData;
};

#endif // STANDARDTABLEMODEL_H
